package com.summer.data.jql.concept.exp;


import com.summer.data.Jsql;
import com.summer.data.dialect.Dialect;
import com.summer.data.jql.Context;
import com.summer.data.jql.behavior.FilterAble;
import com.summer.data.jql.concept.Field;

/**
 * @author 345480567@qq.com
 */
public class BetweenFilterExp implements FilterAble {

    Field field;

    Field st;

    Field ed;

    public BetweenFilterExp(Field field, Field st, Field ed) {
        this.field = field;
        this.st = st;
        this.ed = ed;
    }

    @Override
    public Jsql toFilterJsql(Context ctx, Dialect dialect) {
        Jsql jsql = Jsql.format(" %s BETWEEN %s AND %s ",
                field.toFieldSql(ctx, dialect),
                st.toFieldSql(ctx, dialect),
                ed.toFieldSql(ctx, dialect));
        return jsql;
    }
}

